package com.aod.benefit;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SenhaActivity extends Activity {
    
	private String pwdBenefit = "";
	
	private EditText etSenha;
	private Button btEntrar;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_senha);
		
		etSenha = (EditText)this.findViewById(R.id.etSenha);
		btEntrar = (Button)this.findViewById(R.id.btEntrar);
		
		SharedPreferences loginPreferences = getSharedPreferences(
				"Benefits", Context.MODE_PRIVATE);
					
		pwdBenefit = 
		loginPreferences.getString(
				"pwdBenefit",
				pwdBenefit);
		
		btEntrar.setOnClickListener(new OnClickListener() {			
			@Override
			public void onClick(View v) {
				if(pwdBenefit.equals(etSenha.getText().toString()))
				{
					Intent i = new Intent(SenhaActivity.this, MainActivity.class);
            		startActivity(i);
				}
			}
		});
		
		
    }
    
}
